#ifndef FUDP_RECIVER
#define FUDP_RECIVER

// #include "configure.hpp"
#include "common_conf.hpp"
#include <string>
#include <cstring>
#include <unistd.h>
using namespace std;

class fudpReciver
{
private:
    int socket_id;
    struct sockaddr_in dst_address;
    string srcName;

    // the last unack packet
    int recBase;
    // the next packet to send
    int nextSeqNum;

    //sendBas's index in window
    int recBaseIndex;

    // the buffer
    char window[reciver_window_size][max_datagram_size];

    int overFlag;
public:
    fudpReciver(int _socket_id,struct sockaddr_in& _dst_address, const char* filename);

    bool recieve();

    void handleDataThread();

    void recThread();
};

#endif